<?php $slid = $this->getSlid(); ?>
<?php if($slid > 0): ?>
    <?php 
    $sliderData = $this->getMDSliderById($slid);
    $slider = $sliderData['slider'];
    $slides = $sliderData['slides'];
    ?>

    <div id="md-slider-<?php echo $slider['slid'];?>" class="md-slide-items" <?php echo $slider['data_properties'];?>>
        <?php foreach ($slides as $index => $slide):?>
            <?php $slide = Mage::helper('slider')->preprocess_admin_slide_render($slide); ?>
            <?php $slideSetting = Mage::helper('slider')->processSlideSettings($slide['settings']); ?>
            <?php $layers = $slide['layers']; ?>
            <div class="md-slide-item slide-<?php echo $index+1;?>" <?php echo $slideSetting['data_properties'] ?> >
                <div class="md-mainimg"><img src="<?php echo $slideSetting['background_image'];?>" alt="" <?php echo $slide['background_style'];?> /></div>
                <div class="md-objects">
                <?php if(count($layers) > 0): ?>
                    <?php foreach ($layers as $layerIndex => $layer):?>
                        <?php $layer = Mage::helper('slider')->processLayerData($layer); ?>
                        <div class="md-object <?php echo $layer['style'];?>" <?php echo $layer['data'];?> data-speed="300" <?php echo ($layer['styles'] != '') ? " style='".$layer['styles']."'" : ''?>>
                            <?php if ($layer['type'] == 'text'): ?>
                              <p><?php print $layer['title']; ?></p>
                            <?php elseif ($layer['type'] == 'image'): ?>
                              <img src="<?php print $layer['url'];?>"/>
                            <?php elseif ($layer['type'] == 'video'): ?>
                              <a title="<?php print $layer['title']; ?>" class="md-video" href="#" videoid="<?php print $layer['fileid'];?>">
                                  <img src="<?php print $layer['thumb'];?>" />
                                  <span class="md-playbtn"></span>
                              </a>
                            <?php endif; ?>
                          </div>
                    <?php endforeach;?>
                <?php endif; ?>
              </div>
            </div>
        <?php endforeach;?>
    </div>


    <script type="text/javascript" charset="utf-8">
        (function(){
            jQuery(document).ready(function(){
                jQuery('#md-slider-<?php echo $slider['slid'];?>').mdSlider({
                    transitions: '<?php echo $slider['settings']['animation'] ?>',
                    height: <?php echo $slider['settings']['height'] ?>,
                    width: <?php echo $slider['settings']['width'] ?>,
                    fullwidth: '<?php echo $slider['settings']['full_width'] ?>',
                    border: 0,
                    fullScreen: true,
                    showArrow: <?php echo $slider['settings']['show_next_prev_button'] ?>,
                    showLoading: <?php echo ($slider['settings']['ldbar'] != 'none') ? 1 : 0 ?>,
                    loadingPosition: '<?php echo $slider['settings']['bar_position'] ?>',
                    slideShow: true,
                    autoPlay: <?php echo $slider['settings']['auto_play'] ?>,
                    showButton: <?php echo $slider['settings']['show_bullet'] ?>,
                    showThumb: <?php echo $slider['settings']['show_thumbnail'] ?>,
                    playButton: true,
                    slideShowDelay: <?php echo $slider['settings']['delay'] ?>,
                    transitionsTime: <?php echo $slider['settings']['transtime'] ?>,
                    responsive: <?php echo $slider['settings']['responsive'] ?>,
                    showBullet: <?php echo $slider['settings']['show_bullet'] ?>,
                    posBullet: <?php echo $slider['settings']['bullet_position'] ?>
                });
            });
        })(jQuery);
    </script>
<?php endif; ?>    